﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Primitives;

namespace CompositionPlugin.Service
{
    [MetadataAttribute]
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
    public class DataTemplateExportAttribute : ExportAttribute, IDataTemplateExportMetadata
    {
        public DataTemplateExportAttribute(Type targetType) : this(targetType, null) { }

        public DataTemplateExportAttribute(Type targetType, string viewState) : this(targetType.FullName, viewState) { }

        public DataTemplateExportAttribute(string targetTypeName) : this(targetTypeName, null) { }

        public DataTemplateExportAttribute(string targetTypeName, string viewState) : base(typeof(IDataTemplateFactory))
        {
            this.TargetTypeName = targetTypeName;
            this.ViewState = viewState;
        }
        /// <summary>
        /// Typename
        /// </summary>
        public string TargetTypeName { get; private set; }
        /// <summary>
        /// ViewState
        /// </summary>
        public string ViewState { get; private set; }
    }
}
